<!--
 * @Author: bln
 * @Date: 2024-08-07 00:00:00
 * @FilePath: dev\pages\law\lawsRegulations\subPage.vue
 * @Description: 法律法规-功能列表页面
-->

<template>
  <view class="page">
    <!-- #ifdef H5-ONLY -->
    <theme-navbar :is-white="false" :title="title" :custom-back="goBack" style="z-index: 99999" />
    <!-- #endif -->
    <view class="u-page">
      <!-- 搜索栏 -->
      <view class="u-p-t-30">
        <u-search
          shape="round"
          :animation="true"
          :clearabled="true"
          :showAction="true"
          actionText="确定"
          placeholder="请填写搜索关键词"
          v-model="keyWords"
          @custom="handlerSearch"
          class="u-m-l-20 u-m-r-20 u-m-b-30"
        />
      </view>
      <!-- 列表 -->
      <view class="content u-page">
        <me-table :i="0" :top="108" :index="0" :load-data="loadData" :init-load="false" ref="mescrollItem0">
          <view class="card" slot-scope="d" @click="viewDetail(d.data)">
            <u-row class="u-m-b-20">
              <u-col span="12" class="title">
                {{ d.data.knowledgeTitle || "/" }}
                <span class="u-p-l-6" v-if="d.data.knowledgeSubTitle">- {{ d.data.knowledgeSubTitle || "/" }}</span>
              </u-col>
            </u-row>
            <u-row>
              <u-col span="5">
                <view class="subTitle">发布人</view>
                <view class="info">{{ d.data.creatorName || "/" }}</view>
              </u-col>
              <u-col span="7">
                <view class="subTitle">发布时间</view>
                <view class="info">{{ d.data.releaseTime || "/" }}</view>
              </u-col>
            </u-row>
            <u-row class="u-m-t-20 type">
              <u-col span="12">分类：{{ d.data.knowledgeTypeFullName || "/" }}</u-col>
            </u-row>
          </view>
        </me-table>
      </view>
    </view>
  </view>
</template>

<script>
import MeTable from '@/components/me-table.vue'
import queryService from '@/service/query/query.service.js'
import MescrollMoreMixin from '@/components/mescroll-uni/mixins/mescroll-more.js'

export default {
  components: { MeTable },
	mixins: [MescrollMoreMixin],
  data() {
    return {
      id: '',
      title: '',
      keyWords: ''
    }
  },
  onLoad(opt) {
    this.title = opt.title
    if(opt.id) {
      this.id = opt.id
    } else {
      this.$u.error('参数错误')
    }
  },
  methods: {
    // 初始化列表数据
    loadData(page) {
      return queryService.getFileList({
        page: page.num,
        limit: page.size,
        paras: {
          releaseStatus: 3,
          keyWords: this.keyWords,
          knowledgeType: this.id
        }
      })
    },
    // 查看详情
    viewDetail(record) {
      this.$u.route({
        url: '/pages/law/lawsRegulations/detail',
        params: {
          title: this.title,
          docId: record.knowledgeUuid
        }
      })
    },
    // 列表刷新
    handlerSearch() {
      this.getMescroll(0).triggerDownScroll()
    }
  }
}
</script>

<style lang="scss" scoped>
.page {
  padding: 0;
}
.content {
  background-color: #f3f4f5;
}
.card {
  padding: 20rpx;
}
.title {
  font-size: 32rpx;
  font-weight: 600;
  color: #393B3D;
  span {
    font-size: 30rpx;
  }
}
.subTitle {
  color: #909399;
  padding-bottom: 5px;
  font-size: 14px;
}
.type {
  padding: 8px 5px;
  border-radius: 5px;
  color: #606266;
  background-color: #ecf2fd;
}
.info {
  color: #606266;
  font-weight: 600;
  margin-bottom: 5px;
}
.mescroll-body {
  padding-top: 0px!important;
}
</style>